package com.xiongtian.springframework.beans.factory;

import com.xiongtian.springframework.beans.BeansException;

import java.util.Map;

/**
 * @Author: xiongtian
 * @CreateTime: 2025-03-27  11:31
 * @Version: 1.0
 * @Description: Extension of the {@link BeanFactory} interface to be implemented by bean factories
 * that can enumerate all their bean instances, rather than attempting bean lookup
 * by name one by one as requested by clients. BeanFactory implementations that
 * preload all their bean definitions (such as XML-based factories) may implement
 * this interface.
 * <p>
 */

public interface ListableBeanFactory extends BeanFactory {

    /**
     * 按照类型返回Bean实例
     *
     * @param type 类型
     * @param <T>  Bean类型
     * @return Bean实例的集合
     * @throws BeansException 异常
     */
    <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException;


    /**
     * 返回注册表中所有的Bean名称
     * Return the names of all beans defined in this registry.
     *
     * @return Bean名称数组
     */
    String[] getBeanDefinitionNames();
}
